/**
 * 
 */
package com.spaceserviver;

import com.badlogic.gdx.Application;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.spaceserviver.screens.MainMenu;
import com.spaceserviver.screens.Screen;

/**
 * @author kot
 * 
 */
public class ScreenManager implements ApplicationListener {

	Screen curentScreen;

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.badlogic.gdx.ApplicationListener#create()
	 */
	@Override
	public void create() {
		// TODO Auto-generated method stub
		curentScreen = new MainMenu(Gdx.app);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.badlogic.gdx.ApplicationListener#dispose()
	 */
	@Override
	public void dispose() {
		// TODO Auto-generated method stub

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.badlogic.gdx.ApplicationListener#pause()
	 */
	@Override
	public void pause() {
		// TODO Auto-generated method stub

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.badlogic.gdx.ApplicationListener#render()
	 */
	@Override
	public void render() {
		Application app = Gdx.app;

		// update the screen
		curentScreen.update(app);

		// render the screen
		curentScreen.render(app);

		// when the screen is done we change to the
		// next screen
		if (curentScreen.isDone()) {
			// dispose the current screen
			curentScreen.dispose();

			curentScreen = curentScreen.getNextScreen();
		}

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.badlogic.gdx.ApplicationListener#resize(int, int)
	 */
	@Override
	public void resize(int arg0, int arg1) {
		// TODO Auto-generated method stub

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.badlogic.gdx.ApplicationListener#resume()
	 */
	@Override
	public void resume() {
		// TODO Auto-generated method stub

	}

}
